'use strict';

// 初始化输入框动画事件
function titileInputInit() {
    bindSlidePanel();
    bindHidePanel();
}

// 输入框点击展示标题画
function bindSlidePanel() {
    $(".weui-cells_form input").on("touchstart", function(e) {
        var panelId = "#" + e.target.id + "_panel";
        var $panenlId = $(panelId);
        $panenlId.css("display", "block");
        $panenlId.animate({
            "opacity": 0.8,
            "top": "8px"
        });
        console.dir(e);
    });
}

// 输入框改变 如果没有内容 标题收起动画,有展示动画 
function bindHidePanel() {
    $(".weui-cells_form input").on("blur", function(e) {
        var panelId = "#" + e.target.id + "_panel";
        var $panenlId = $(panelId);
        if (this.value == "") {
            $panenlId.animate({
                "opacity": 0,
                "top": "32px"
            });
            setTimeout(function() {
                $panenlId.css("display", "none");
            }, 500);

        } else {
            $panenlId.css("display", "block");
            $panenlId.animate({
                "opacity": 0.8,
                "top": "8px"
            });
        }

    });
}

export {
    titileInputInit
}